home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / program / snip9611.zip / DEQUEUE.H < prev    next >
C/C++ Source or Header  |  1996-11-24  |  2KB  |  67 lines

  1. /* +++Date last modified: 02-Nov-1995 */
  2.  
  3. /*
  4.  *  File : Queue.h
  5.  *
  6.  *  Peter Yard  02 Jan 1993.
  7.  */
  8.  
  9. #ifndef DEQUEUE__H
  10. #define DEQUEUE__H
  11.  
  12. #include "sniptype.h"                     /* For True_, False_    */
  13.  
  14.  
  15. typedef struct nodeptr datanode;
  16.  
  17. typedef struct nodeptr {
  18.  
  19.     void        *data ;
  20.     datanode    *prev, *next ;
  21.  
  22. } node ;
  23.  
  24. typedef struct {
  25.  
  26.     node        *head, *tail, *cursor;
  27.     int         size, sorted, item_deleted;
  28.  
  29. } queue;
  30.  
  31. typedef  struct {
  32.  
  33.     void        *dataptr;
  34.     node        *loc ;
  35.  
  36. } index_elt ;
  37.  
  38.  
  39. int  Q_Init( queue  *q ) ;
  40. int  Q_Empty( queue *q );
  41. int  Q_Size( queue *q ) ;
  42. int  Q_Start( queue *q );
  43. int  Q_End( queue *q );
  44. int  Q_PushHead( queue *q, void *d ) ;
  45. int  Q_PushTail( queue *q, void *d ) ;
  46. void *Q_First( queue *q ) ;
  47. void *Q_Last( queue *q ) ;
  48. void *Q_PopHead( queue *q ) ;
  49. void *Q_PopTail( queue *q ) ;
  50. void *Q_Next( queue *q ) ;
  51. void *Q_Previous( queue *q ) ;
  52. void *Q_DelCur( queue *q ) ;
  53. void *Q_Get( queue *q ) ;
  54. int  Q_Put( queue *q, void *data ) ;
  55. int  Q_Sort( queue *q, int Comp(const void *, const void *) ) ;
  56. int  Q_Find( queue *q, void *data,
  57.             int Comp(const void *, const void *) ) ;
  58. void *Q_Seek( queue *q, void *data,
  59.             int Comp(const void *, const void *) ) ;
  60. int  Q_Insert( queue *q, void *data,
  61.             int Comp(const void *, const void *) ) ;
  62.  
  63. static int  Q_BSearch( queue *q, void *key,
  64.                         int Comp(const void *, const void * ) );
  65.  
  66. #endif /* DEQUEUE__H */
  67.